package cn.gjxblog;

import cn.gjxblog.robot.CoordBean;
import cn.gjxblog.robot.RobotPlus;

import java.awt.*;

/**
 * @Author guojiaxun
 * @Date 2019/9/26 10:52
 */
public class Test {
    private static final String openBtn ="";
    private static final String autoBtn ="";
    private static final String skipBtn ="";
    private static final String returnBtn ="";

    public static void main(String[] args) throws AWTException {
        RobotPlus robot = new RobotPlus();
//        CoordBean coordBean = robot.imageSearch("H:\\test.png");
//        robot.mouseRightClick(coordBean.getX(), coordBean.getY());
//        CoordBean open;
//
//        do{
//            open = robot.imageSearch("H:\\open.png");
//            if(open != null) {
//                robot.mouseLeftClick(open.getX() + 1, open.getY());
//            }
//            System.out.println(open);
//        }while (open == null);

        //1 开始
        //2 自动
        //3 跳过对话
        //4 返回
        int count =100;
        while(count > 0){
            //自动
            CoordBean openBean;
            do {
                openBean = robot.imageSearch(openBtn);
                if(openBean != null){
                    robot.mouseLeftClick(openBean.getX() + 1, openBean.getY());
                }
            }while (openBean == null);

            //自动
            CoordBean autoBean;
            do{
                autoBean = robot.imageSearch(autoBtn);
                if(autoBean != null) {
                    robot.mouseLeftClick(autoBean.getX() + 1, autoBean.getY());
                }
                System.out.println(autoBean);
            }while (autoBean == null);

            //返回
            CoordBean returnBean;
            do{
                returnBean = robot.imageSearch(returnBtn);
                if(returnBean != null) {
                    robot.mouseLeftClick(returnBean.getX() + 1, returnBean.getY());
                }
                System.out.println(returnBean);
            }while (returnBean == null);

            count--;

        }


    }
}
